﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using gametest.DxAPI;
using System.Diagnostics;

namespace gametest.sprites
{
    public class vit : sprite
    {
        private DxImageObject imagevit = null;
        private const double SPEED = 0.2;

        private double direction = 1;
        //private bool collision = false;

        protected static double X_Pad = 0;
        protected static double Y_Pad = 0;

        public vit(DxInitGraphics g)
            : base(g)
        {
            imagevit = new DxImageObject("Images\\vit.png", BitmapType.TRANSPARENT, 0xFFFFFF, graphics.DDDevice);
            //          imagetrung = new DxImageObject("Images\\egg.png", BitmapType.TRANSPARENT, 0xFFFFFF, graphics.DDDevice);

            X_Axis = imagevit.XPosition = 350;
            Y_Axis = imagevit.YPosition = 70;

            X_Pad = X_Axis + 30;
            Y_Pad = Y_Axis + 30;
        }

        public override void Draw()
        {
            imagevit.DrawBitmap(graphics.RenderSurface);
            //throw new NotImplementedException();
        }

        override public void Restore(DxInitGraphics g)
        {
            graphics = g;
            imagevit.RestoreSurface();
            //throw new NotImplementedException();
        }

        public void MoveVit(double dLoopDuration)
        {
            X_Axis += direction * (SPEED * dLoopDuration);

            if (X_Axis > (graphics.Target.Width - imagevit.Width))
            {

                X_Axis = (graphics.Target.Width - imagevit.Width);
                direction = -1;
            }

            if (X_Axis < 0)
            {
                X_Axis = 0;
                direction = 1;
            }
        }

        //public void visibe(double dLoopDuration)
        //{
        //    imagega.DrawBitmap(graphics.RenderSurface);
        //    imagega.Visible = true;
        //    //throw new NotImplementedException();
        //}

    }
}
